package dome1;

/**
 * Created with IntelliJ IDEA.
 * Description:
 * User: DickYang
 * Date: 2023-06-22
 * Time: 19:33
 */
class MyArray1<T> {
    //这种创建数组不常用!!!
    public T[] obj = (T[])new Object[3];

    public T getPos(int pos) {
        return obj[pos];
    }
    public void setObj(int pos,T val) {
        obj[pos] = val;
    }
}
public class Test {
    public static void main(String[] args) {
        MyArray1<Integer> myArray1 = new MyArray1<>();
        myArray1.setObj(0,10);
        myArray1.setObj(1,20);
        myArray1.setObj(2,30);

        Integer a = myArray1.getPos(0);
        System.out.println(a);
    }
}

